<template>
  <div class="person">
    <h2>当前求和为：{{ sum }}</h2>
    <button @click="addOne">+1</button>
    <hr />
    <img
      v-for="(item, index) in dogList"
      :src="item"
      alt="fruit"
      :key="index"
    />
    <button @click="comeOn">再来一只修勾</button>
  </div>
</template>

<script setup name="Person" lang="ts">
//hooks 的本质就是一个个可以调用的函数

import useSum from "../hooks/useSum";
import useDog from "../hooks/useDog";

const { sum, addOne } = useSum();
const { dogList, comeOn } = useDog();
</script>

<style scoped>
.person {
  background-color: #c2e0f6;
  box-shadow: 0 0 10px;
  border-radius: 10px;
  padding: 20px;
}
button {
  margin: 0 5px;
}
img {
  height: 100px;
  margin-right: 10px;
}
</style>